#include "drawer.h"
#include <QGroupBox>
#include <QVBoxLayout>


#include "dialognewuser.h"
#include <QDebug>
#include <QSqlError>
#include <QSqlTableModel>
#include <QMessageBox>
#include "mydialog.h"

Drawer::Drawer(QWidget *parent, Qt::WindowFlags f)
    :QToolBox(parent,f)

{


    setWindowTitle(tr("约吧"));                   //设置主窗体的标题
    setWindowIcon(QPixmap(":/images/qq.png"));              //设置主窗体标题栏图标

    toolBtn1 =new QToolButton;
    toolBtn1->setText(tr("土豪"));
    toolBtn1->setIcon(QPixmap(":/images/spqy.png"));
    toolBtn1->setIconSize(QPixmap(":/images/spqy.png").size());
    toolBtn1->setAutoRaise(true);
    toolBtn1->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    connect(toolBtn1,SIGNAL(clicked()),this,SLOT(showChatWidgett1()));



    QGroupBox *groupBox=new QGroupBox;
    QVBoxLayout *layout=new QVBoxLayout(groupBox);
    layout->setMargin(20);//布局中各窗体的显示间距
    layout->setAlignment(Qt::AlignLeft);//布局中各窗体的显示位置
    layout->addWidget(toolBtn1);


    layout->addStretch();//插入一个占位符


        QGroupBox *groupBox1=new QGroupBox;


        this->addItem((QWidget*)groupBox,tr("我的好友"));
        this->addItem((QWidget*)groupBox1,tr("常聊"));
}

void Drawer::showChatWidgett1()
{


    chatWidgett1  = new Widget(0,toolBtn1->text());
    chatWidgett1->setWindowTitle(toolBtn1->text());
    chatWidgett1->setWindowIcon(toolBtn1->icon());
    chatWidgett1->show();
}

